/* 基础样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #ffffff;
    color: #333333;
    line-height: 1.6;
}

/* 容器 */
.container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 导航栏样式 */
.navbar {
    background: #000000;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #cccccc;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: #ffffff;
}

.nav-links {
    display: flex;
    gap: 1rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    text-decoration: none;
    color: #cccccc;
    border-radius: 4px;
    transition: all 0.3s ease;
    font-weight: 500;
}

.nav-link:hover {
    background: #333333;
    color: #ffffff;
}

.nav-link.active {
    background: #ffffff;
    color: #000000;
}

/* 主要内容区域 */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.layout-container {
    flex: 1;
    display: flex;
    min-height: calc(100vh - 80px);
}

/* 左侧边栏 */
.sidebar {
    width: 300px;
    background-color: #f8f9fa;
    border-right: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e0e0e0;
    background-color: #ffffff;
}

.sidebar-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333333;
}

.settings-section {
    flex: 1;
    padding: 1.5rem;
}

.setting-group {
    margin-bottom: 1.5rem;
}

.setting-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #555555;
    font-size: 0.9rem;
}

.setting-group input,
.setting-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #cccccc;
    border-radius: 4px;
    font-size: 0.9rem;
    background-color: #ffffff;
    color: #333333;
}

.setting-group input:focus,
.setting-group select:focus {
    outline: none;
    border-color: #666666;
}

.clear-btn {
    width: 100%;
    padding: 0.75rem;
    background-color: #ffffff;
    color: #333333;
    border: 1px solid #cccccc;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.clear-btn:hover {
    background-color: #f8f9fa;
    border-color: #999999;
}

.char-count {
    font-size: 0.8rem;
    color: #666666;
    text-align: right;
    margin-top: 0.5rem;
    padding-right: 0.5rem;
}

/* 右侧对话区域 */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: #ffffff;
}

.chat-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid #e0e0e0;
    background-color: #ffffff;
}

.chat-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #333333;
    margin-bottom: 0.5rem;
}

.chat-header p {
    color: #666666;
    font-size: 0.95rem;
}

/* 聊天消息区域 */
.chat-messages {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
    background-color: #ffffff;
}

.welcome-message {
    text-align: center;
    padding: 3rem 2rem;
    color: #666666;
}

.welcome-message h3 {
    font-size: 1.25rem;
    color: #333333;
    margin-bottom: 1rem;
    font-weight: 600;
}

.welcome-message p {
    margin-bottom: 1rem;
    line-height: 1.6;
}

.welcome-features {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-top: 2rem;
}

.feature-item {
    padding: 0.75rem 1.5rem;
    background-color: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    font-size: 0.9rem;
    color: #555555;
}

/* 消息样式 */
.message {
    box-sizing: border-box;
    margin-bottom: 1.5rem;
    max-width: 80%;
    width: fit-content;
    min-width: 120px;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.message.user {
    margin-left: auto;
    flex-direction: row-reverse;
}

.message.assistant {
    margin-right: auto;
    flex-direction: row;
}

.message.error {
    margin-right: auto;
    flex-direction: row;
}

.message-icon {
    font-size: 1rem;
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background-color: #f0f0f0;
    border: 1px solid #e0e0e0;
}

.message.user .message-icon {
    background-color: #e3f2fd;
    border-color: #bbdefb;
}

.message.assistant .message-icon {
    background-color: #f3e5f5;
    border-color: #ce93d8;
}

.message.error .message-icon {
    background-color: #ffebee;
    border-color: #ffcdd2;
}

.message-content {
    line-height: 1.6;
    padding: 1rem;
    flex: 1;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.message.user .message-content {
    background-color: #f8f9fa;
    text-align: right;
}

.message.assistant .message-content {
    background-color: #ffffff;
}

.message.error .message-content {
    background-color: #fff5f5;
    border-color: #fed7d7;
    color: #c53030;
}

.message-time {
    font-size: 0.8rem;
    color: #999999;
    margin-top: 0.5rem;
}

/* 输入区域 */
.input-container {
    padding: 1.5rem 2rem;
    background-color: #f8f9fa;
    border-top: 1px solid #e0e0e0;
}

.input-wrapper {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
}

#messageInput {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid #cccccc;
    border-radius: 4px;
    font-size: 0.9rem;
    resize: none;
    min-height: 80px;
    font-family: inherit;
    background-color: #ffffff;
    color: #333333;
}

#messageInput:focus {
    outline: none;
    border-color: #666666;
}

#messageInput::placeholder {
    color: #999999;
}

.send-btn {
    padding: 0.75rem 1.5rem;
    background-color: #000000;
    color: #ffffff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    min-width: 80px;
    height: 80px;
    transition: all 0.2s ease;
}

.send-btn:hover:not(:disabled) {
    background-color: #333333;
}

.send-btn:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

.loading-spinner {
    display: none;
}

/* 消息提示 */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background-color: #333333;
    color: #ffffff;
    padding: 1rem 1.5rem;
    border-radius: 4px;
    z-index: 1000;
    font-size: 0.9rem;
}

.toast-content {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Markdown 内容样式 */
.message-content h1,
.message-content h2,
.message-content h3,
.message-content h4,
.message-content h5,
.message-content h6 {
    margin: 1rem 0 0.5rem 0;
    font-weight: 600;
    color: #333333;
}

.message-content h1 {
    font-size: 1.25rem;
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 0.5rem;
}

.message-content h2 {
    font-size: 1.1rem;
}

.message-content h3 {
    font-size: 1rem;
}

.message-content p {
    margin: 0.5rem 0;
    line-height: 1.6;
}

.message-content ul,
.message-content ol {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

.message-content li {
    margin: 0.25rem 0;
}

.message-content blockquote {
    margin: 1rem 0;
    padding: 0.75rem 1rem;
    border-left: 3px solid #cccccc;
    background-color: #f8f9fa;
    color: #555555;
}

.message-content code {
    background-color: #f8f9fa;
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.85rem;
    color: #333333;
}

.message-content pre {
    margin: 1rem 0;
    padding: 1rem;
    background-color: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    overflow-x: auto;
}

.message-content pre code {
    background: none;
    padding: 0;
    border-radius: 0;
    font-size: 0.8rem;
}

.message-content table {
    border-collapse: collapse;
    margin: 1rem 0;
    width: 100%;
}

.message-content th,
.message-content td {
    border: 1px solid #e0e0e0;
    padding: 0.5rem;
    text-align: left;
}

.message-content th {
    background-color: #f8f9fa;
    font-weight: 600;
}

.message-content a {
    color: #333333;
    text-decoration: underline;
}

.message-content a:hover {
    color: #000000;
}

/* 滚动条样式 */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #cccccc;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #999999;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .layout-container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
    }
    
    .navbar {
        padding: 1rem;
    }
    
    .nav-links {
        gap: 1rem;
    }
    
    .chat-header {
        padding: 1rem;
    }
    
    .chat-messages {
        padding: 1rem;
    }
    
    .input-container {
        padding: 1rem;
    }
    
    .input-wrapper {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .send-btn {
        width: 100%;
        height: auto;
        min-height: 45px;
    }
    
    .welcome-features {
        flex-direction: column;
        gap: 1rem;
        align-items: center;
    }
    
    .feature-item {
        width: 100%;
        text-align: center;
    }
    
    .message {
        max-width: 95%;
    }
}